//
//  RECMediaTypeSixCell.m
//  CarFace
//
//  Created by dlios on 15/3/26.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "RECMediaTypeSixCell.h"


@interface RECMediaTypeSixCell ()
// mediatype == 6
@property (nonatomic, retain)UIImageView *imageViewOne;
@property (nonatomic, retain)UIImageView *imageViewTwo;
@property (nonatomic, retain)UIImageView *imageViewThree;

@end

@implementation RECMediaTypeSixCell
- (void)dealloc
{
    [_imageViewOne release];
    [_imageViewTwo release];
    [_imageViewThree release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.imageViewOne = [[UIImageView alloc] init];
        [self.contentView addSubview:self.imageViewOne];
        [_imageViewThree release];
        self.imageViewTwo = [[UIImageView alloc] init];
        [self.contentView addSubview:self.imageViewTwo];
        [_imageViewThree release];
        self.imageViewThree = [[UIImageView alloc] init];
        [self.contentView addSubview:self.imageViewThree];
        [_imageViewThree release];
        

    }
    return self;
    
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    // mediatype的value = 6
    
    CGFloat width = self.contentView.bounds.size.width;
    CGFloat height = self.contentView.bounds.size.height;
    self.imageViewOne.frame = CGRectMake(width / 40, width / 80, width * 3 / 10 , height - width / 40);
    self.imageViewTwo.frame = CGRectMake(width * 2 / 40 + width * 3 / 10, width / 80, width * 3 / 10 , height - width / 40);
    self.imageViewThree.frame = CGRectMake(width * 3 / 40 + width * 6 / 10, width / 80, width * 3 / 10 , height - width / 40);
 
    // 三个图片, 处理
    NSArray *line = [self.newlist.indexdetail componentsSeparatedByString:@","];

    if (line.count >= 2) {
        //
        //            //第一个
        NSString *lineOne = [[[line firstObject] componentsSeparatedByString:@"㊣"] lastObject] ;

        lineOne =  [lineOne stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
        NSURL *urlOne = [NSURL URLWithString:lineOne];
        [self.imageViewOne setImageWithURL:urlOne];
        // 后两个
        NSString *lineTwo = [[line objectAtIndex:1] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] ;
        NSURL *urlTwo = [NSURL URLWithString:lineTwo];
        [self.imageViewTwo setImageWithURL:urlTwo];
        //
        NSString *lineThree = [[line objectAtIndex:2] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] ;
        NSURL *urlThree = [NSURL URLWithString:lineThree];
        [self.imageViewThree setImageWithURL:urlThree];
    }
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
